<?php
//    if(!empty($suburb_around)){
//        foreach ($suburb_around as $item){
//            echo $item['Locality'],$item['Pcode'],$item['State1'];?><br><?php
//        }
//    }
//    echo'hello';
?>
    <script type="text/javascript">
        //        $(function(){
        //            setAutoComplete("search", "results", "<?php echo site_url('home/ajax_search?part=') ?>");
        //        });
        $(document).ready(function(){
            $( "#suburbs" ).autocomplete({
            delay: 100,
            source: function(request, response) {
                    $.ajax({
                    url: "<?php echo site_url('home/ajax_search?part=') ?>"+request.term,
                    dataType: 'json',
                    success: function(json) {		
                            response($.map(json, function(item,key) {
                            return {
                            label: item,
                            values: key
                                                    }
                                            }));
                    return false
                                    }
                            });
                    }, 
                    select: function(event, ui) {
            $( "#keyword_1" ).val(ui.item.values);
                    },
                    focus: function(event, ui) {
            return false;
                    }
            });
        })
    </script>
    <div class="content office-page" id="page-body">
	<div id="search-properties-1">
            <form method="POST">
                    <div id="searchform-title" class="clearfix">
                        <div id="searchform-box">
                                <div class="search-image">
                                        <input type="text" name="suburbs" id="suburbs" placeholder="Suburb/Town" />
                                </div>
                            <input type="hidden" id="keyword_1" value="<?php echo!empty($post['suburbs_id']) ? $post['suburbs_id'] : '' ?>" name ="suburbs_id">
                            <div id="results-suburbs"></div>
                        </div>
                        <h4>Results for <?php if(!empty($Locality)) echo $Locality;?></h4>
                        <?php                            
                            if(!empty($suburb_around)){
                                foreach ($suburb_around as $item){
                                    echo $item['Locality'];?>&nbsp<?php
                                    echo $item['State1'];?>&nbsp<?php
                                    echo $item['Pcode'];?>&nbsp;<br><?php
                                    
                                }
                            }
                        ?>
                    </div>
            </form>
        </div>
    </div>
    </form>
    